<template>
  <el-dialog
    :title="'销售订单详情'"
    :close-on-click-modal="false"
    :visible.sync="visible"
    >
    <el-descriptions-item :v-model="dataList">销售订单号:{{dataList[0].soId}}</el-descriptions-item>

    <el-table
      :data="dataList" 
      style="width: 100%;">
      
      <!-- <el-table-column
        prop="soId"
        header-align="center"
        align="center"
        label="销售订单号">
      </el-table-column> -->
         
      <el-table-column
        prop="goodsName"
        header-align="center"
        align="center"
        label="商品名字">
      </el-table-column>

      <el-table-column
        prop="goodsNum"
        header-align="center"
        align="center"
        label="商品数量">
      </el-table-column>

      <el-table-column
        prop="goodsPr"
        header-align="center"
        align="center"
        label="商品总价">
      </el-table-column>

    </el-table>
    <el-descriptions-item :v-model="dataList" >用户姓名:{{dataList[0].userName}}</el-descriptions-item>
    <el-descriptions-item :v-model="dataList" style="margin-left: 500px;" >时间:{{dataList[0].createTime}}</el-descriptions-item>

  </el-dialog>
</template>

<script>
  export default {
    data () {
      return {
        visible: false,
        dataList: [],
        dataForm:{
          soId:0
        }
      }
    },
    created(){
      this.init()
    },
    methods: { 
      init (id) {
       console.log(id)
        this.visible = true
            this.$http({
              url: this.$http.adornUrl(`/admin/ssmsodetails/findOrderInfoById/${id}`),
              method: 'get',
              params: this.$http.adornParams()
            }).then(({data}) => {
              if (data && data.code === 0) {
                console.log(data.dataForm)
                this.dataList = data.saleOrderDtoList
                
              }
            })
          
          
        
      },

      // // 表单提交
      // dataFormSubmit () {
      //   this.$refs['dataForm'].validate((valid) => {
      //     if (valid) {
      //       this.$http({
      //         url: this.$http.adornUrl(`/admin/ssmsodetails/${!this.dataForm.id ? 'save' : 'update'}`),
      //         method: 'post',
      //         data: this.$http.adornData({
      //           'id': this.dataForm.id || undefined,
      //           'soId': this.dataForm.soId,
      //           'goodsId': this.dataForm.goodsId,
      //           'goodsNum': this.dataForm.goodsNum,
      //           'goodsPr': this.dataForm.goodsPr
      //         })
      //       }).then(({data}) => {
      //         if (data && data.code === 0) {
      //           this.$message({
      //             message: '操作成功',
      //             type: 'success',
      //             duration: 1500,
      //             onClose: () => {
      //               this.visible = false
      //               this.$emit('refreshDataList')
      //             }
      //           })
      //         } else {
      //           this.$message.error(data.msg)
      //         }
      //       })
      //     }
      //   })
      // }
    }
  }
</script>
